<template>
    <div>
        <strong style="font-size: 32px;">更改密码</strong>
        <br>
        <span>当前密码
            <input type="password" v-model="old_password">
        </span>
        <br>
        <span>新密码
            <input type="password" v-model="new_password">
        </span>
        <br>
        <span>确认密码
            <input type="password" v-model="confirm_new_password">
        </span>
        <br>
        <span>
            <button @click="update_pwd">更新密码</button>
        </span>
    </div>
</template>
<script setup>
import request from '@/request';
import { ref, reactive } from 'vue';
import { ElMessage } from 'element-plus'
const old_password = ref('')
const new_password = ref('')
const confirm_new_password = ref('')
function update_pwd(){
    request({
        method:'post',
        url:'/password/',
        data:{
            old_password:old_password.value,
            new_password:new_password.value,
            confirm_new_password:confirm_new_password.value,
        }
    }).then(response=>{
        if (response.status==200){
            ElMessage.success('密码更新成功')
        }
    }).catch(error=>{
        ElMessage.error('密码更新失败'+error)
    })
}
</script>
<style scoped>
</style>